package com.heima.article.fallback;

import com.heima.article.IArticleClient;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.dtos.CommentConfigDto;
import com.heima.model.wemedia.dtos.PageCommentDto;
import org.springframework.stereotype.Component;

/**
 * @author 陈辉
 * @data 2023 14:48
 */
@Component
public class ArticleClientFallback implements IArticleClient {
    /**
     * article文章同步接口
     *
     * @param articleDto
     * @return
     */
    @Override
    public ResponseResult saveOrUpdateArticle(ArticleDto articleDto) {
        return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR);  //降级逻辑
    }

    @Override
    public ResponseResult findNewsComments(PageCommentDto dto) {
        PageResponseResult responseResult = new PageResponseResult(dto.getPage(),dto.getSize(),0);
        responseResult.setCode(501);
        responseResult.setErrorMessage("获取数据失败");
        return responseResult;
    }

    @Override
    public ResponseResult updateArticleStatus(CommentConfigDto dto) {
        ResponseResult responseResult = new ResponseResult();
        responseResult.setCode(501);
        responseResult.setErrorMessage("获取数据失败");
        return responseResult;
    }
}
